home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / t2win-32 / _dattim.frm (.txt) < prev    next >
Visual Basic Form  |  1998-07-13  |  32KB  |  509 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDateTime 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Date & Time"
  5.    ClientHeight    =   6495
  6.    ClientLeft      =   1110
  7.    ClientTop       =   1365
  8.    ClientWidth     =   7830
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   6495
  13.    ScaleWidth      =   7830
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.PictureBox Picture1 
  16.       Align           =   2  'Align Bottom
  17.       BorderStyle     =   0  'None
  18.       Height          =   465
  19.       Left            =   0
  20.       ScaleHeight     =   465
  21.       ScaleWidth      =   7830
  22.       TabIndex        =   4
  23.       Top             =   6030
  24.       Width           =   7830
  25.       Begin VB.CommandButton Command2 
  26.          Caption         =   "&Reset"
  27.          Height          =   285
  28.          Left            =   6840
  29.          TabIndex        =   10
  30.          Top             =   105
  31.          Width           =   825
  32.       End
  33.       Begin VB.TextBox Text1 
  34.          Height          =   285
  35.          Left            =   1440
  36.          TabIndex        =   5
  37.          Tag             =   "A/BC/DEF/GHIJ/KLMNOP/"
  38.          Top             =   90
  39.          Width           =   5310
  40.       End
  41.       Begin VB.Label Label1 
  42.          Caption         =   "&Enter a test value"
  43.          Height          =   255
  44.          Left            =   90
  45.          TabIndex        =   6
  46.          Top             =   120
  47.          Width           =   1275
  48.       End
  49.    End
  50.    Begin VB.Frame Frame1 
  51.       Height          =   570
  52.       Left            =   0
  53.       TabIndex        =   1
  54.       Top             =   -90
  55.       Width           =   7830
  56.       Begin VB.CommandButton cmdNP 
  57.          Caption         =   ">"
  58.          Height          =   285
  59.          Index           =   1
  60.          Left            =   7470
  61.          TabIndex        =   9
  62.          Top             =   195
  63.          Width           =   285
  64.       End
  65.       Begin VB.CommandButton cmdNP 
  66.          Caption         =   "<"
  67.          Height          =   285
  68.          Index           =   0
  69.          Left            =   6570
  70.          TabIndex        =   8
  71.          Top             =   195
  72.          Width           =   285
  73.       End
  74.       Begin VB.CommandButton Command1 
  75.          Caption         =   "&Go"
  76.          Default         =   -1  'True
  77.          Height          =   285
  78.          Left            =   6930
  79.          TabIndex        =   7
  80.          Top             =   195
  81.          Width           =   465
  82.       End
  83.       Begin VB.ComboBox cmb_Function 
  84.          Height          =   315
  85.          Left            =   1365
  86.          TabIndex        =   2
  87.          Top             =   180
  88.          Width           =   5115
  89.       End
  90.       Begin VB.Label Label2 
  91.          Caption         =   "&Select a function"
  92.          Height          =   255
  93.          Left            =   90
  94.          TabIndex        =   3
  95.          Top             =   210
  96.          Width           =   1275
  97.       End
  98.    End
  99.    Begin VB.TextBox txt_Result 
  100.       BackColor       =   &H00C0C0C0&
  101.       BorderStyle     =   0  'None
  102.       Height          =   5325
  103.       Left            =   120
  104.       Locked          =   -1  'True
  105.       MultiLine       =   -1  'True
  106.       ScrollBars      =   2  'Vertical
  107.       TabIndex        =   0
  108.       Top             =   600
  109.       Width           =   7575
  110.    End
  111. Attribute VB_Name = "frmDateTime"
  112. Attribute VB_GlobalNameSpace = False
  113. Attribute VB_Creatable = False
  114. Attribute VB_PredeclaredId = True
  115. Attribute VB_Exposed = False
  116. Option Explicit
  117. Option Base 1
  118. Private Const Iteration = 250
  119. Dim IsLoaded         As Integer
  120. Dim TimerStartOk     As Integer
  121. Dim TimerCloseOk     As Integer
  122. Dim TimerHandle      As Integer
  123. Dim TimerValue       As Long
  124. Private Sub cmdNP_Click(Index As Integer)
  125.    Text1.Text = ""
  126.    Call sub_NextPrev(cmb_Function, Index)
  127. End Sub
  128. Private Sub cmb_Function_Click()
  129.    If (IsLoaded = False) Then Exit Sub
  130.    Call cDisableFI(mdiT2W.Picture1)
  131.    txt_Result = ""
  132.    DoEvents
  133.    Select Case cmb_Function.ListIndex
  134.       Case 0
  135.          Call TestDateStatistic
  136.       Case 1
  137.          Call TestDateConvert
  138.       Case 2
  139.          Call TestCnvMinuteToTime
  140.       Case 3
  141.          Call TestCnvMinuteToHundred
  142.       Case 4
  143.          Call TestCnvTimeToMinute
  144.       Case 5
  145.          Call TestCnvHundredToMinute
  146.       Case 6
  147.          Call TestDateHourLong
  148.    End Select
  149.    DoEvents
  150.    Call cEnableFI(mdiT2W.Picture1)
  151. End Sub
  152. Private Sub Form_Activate()
  153.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  154. End Sub
  155. Private Sub Form_Load()
  156.    IsLoaded = False
  157.    Show
  158.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_dattim.t2w")
  159.    IsLoaded = True
  160. End Sub
  161. Private Sub Command1_Click()
  162.    Call cmb_Function_Click
  163. End Sub
  164. Private Sub TestDateStatistic()
  165.    Dim intResult        As Integer
  166.    Dim strResult        As String
  167.    Dim strDisplay       As String
  168.    Dim i                As Integer
  169.    Dim nYear            As Integer
  170.    Dim nMonth           As Integer
  171.    Dim nDay             As Integer
  172.    Dim nNow             As Long
  173.    Dim nIntNow          As Integer
  174.    If (Trim(Text1.Text) = "") Then Text1.Text = Format$(Now, "dd.mm.yyyy")
  175.    nNow = cDateToScalar(Val(Format$(Now, "yyyy")), Val(Format$(Now, "mm")), Val(Format$(Now, "dd")))
  176.    Call cScalarToDate(nNow, nYear, nMonth, nDay)
  177.    strDisplay = "Today is the '" & Text1.Text & "'" & vbCrLf & vbCrLf
  178.    strDisplay = strDisplay & "Day of the week (ISO, U.S., Special) is (" & cDayOfWeek(nYear, nMonth, nDay, True) & ", " & cDayOfWeek(nYear, nMonth, nDay, False) & ", " & cDayOfWeek(nYear, nMonth, nDay, 1) & ") (" & cGetLongDay(LNG_ENGLISH, 1 + cDayOfWeek(nYear, nMonth, nDay, False)) & ")" & vbCrLf
  179.    strDisplay = strDisplay & "Day of the year is '" & cDayOfYear(nYear, nMonth, nDay) & "'" & vbCrLf
  180.    strDisplay = strDisplay & "Week of the year (ISO, U.S., Special) is (" & cWeekOfYear(nYear, nMonth, nDay, True) & ", " & cWeekOfYear(nYear, nMonth, nDay, False) & ", " & cWeekOfYear(nYear, nMonth, nDay, 1) & ")" & vbCrLf & vbCrLf
  181.    nNow = cDateToScalar(nYear, nMonth, nDay)
  182.    strDisplay = strDisplay & "Scalar day is '" & nNow & "'" & vbCrLf
  183.    Call cScalarToDate(nNow, nYear, nMonth, nDay)
  184.    strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
  185.    nIntNow = cDateToInt(nYear, nMonth, nDay)
  186.    strDisplay = strDisplay & "Int day is '" & nIntNow & "'" & vbCrLf
  187.    Call cIntToDate(nIntNow, nYear, nMonth, nDay)
  188.    strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
  189.    nNow = Int(Now)
  190.    nYear = Year(nNow)
  191.    nMonth = 1
  192.    nDay = 1
  193.    strDisplay = strDisplay & "First Day is the '" & Format$(DateSerial(nYear, nMonth, nDay), "short date") & "'" & vbCrLf & vbCrLf
  194.    strDisplay = strDisplay & "Day of the week (ISO, U.S., Special) is (" & cDayOfWeek(nYear, nMonth, nDay, True) & ", " & cDayOfWeek(nYear, nMonth, nDay, False) & ", " & cDayOfWeek(nYear, nMonth, nDay, 1) & ") (" & cGetLongDay(LNG_ENGLISH, 1 + cDayOfWeek(nYear, nMonth, nDay, False)) & ")" & vbCrLf
  195.    strDisplay = strDisplay & "Day of the year is '" & cDayOfYear(nYear, nMonth, nDay) & "'" & vbCrLf
  196.    strDisplay = strDisplay & "Week of the year (ISO, U.S., Special) is (" & cWeekOfYear(nYear, nMonth, nDay, True) & ", " & cWeekOfYear(nYear, nMonth, nDay, False) & ", " & cWeekOfYear(nYear, nMonth, nDay, 1) & ")" & vbCrLf & vbCrLf
  197.    nNow = cDateToScalar(nYear, nMonth, nDay)
  198.    strDisplay = strDisplay & "Scalar day is '" & nNow & "'" & vbCrLf
  199.    Call cScalarToDate(nNow, nYear, nMonth, nDay)
  200.    strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
  201.    nIntNow = cDateToInt(nYear, nMonth, nDay)
  202.    strDisplay = strDisplay & "Int day is '" & nIntNow & "'" & vbCrLf
  203.    Call cIntToDate(nIntNow, nYear, nMonth, nDay)
  204.    strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
  205.    txt_Result = strDisplay
  206.    'time the function
  207.    TimerHandle = cTimerOpen()
  208.    TimerStartOk = cTimerStart(TimerHandle)
  209.    For i = 1 To Iteration
  210.       Call cScalarToDate(nNow, nYear, nMonth, nDay)
  211.    Next i
  212.    mdiT2W.pnl_Timer = cTimerRead(TimerH